//
//  ZGLHTTPRequestManager.m
//  ZeegingLottery
//
//  Created by 李曌 on 2018/7/4.
//  Copyright © 2018年 蒂埃里. All rights reserved.
//

#import "ZGLHTTPRequestManager.h"
#import "ZGLHTTPSessionManager.h"
/**
 请求方式
 */
typedef NS_ENUM(NSInteger, RequestType) {
    RequestTypeGet,
    RequestTypePost,
//    RequestTypeUpLoad,//单个上传
//    RequestTypeMultiUpload,//多个上传
};




@implementation ZGLHTTPRequestManager

+ (instancetype)sharedManager
{
    static id sharedInstance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        sharedInstance = [[self alloc] init];
    });
    
    return sharedInstance;
}


#pragma mark - 各个请求接口集中写在这里

//获取短信验证码接口
- (void)getVerificationCodeWithPhoneNum:(NSString *)mobile
                                Success:(void(^)(void))success
                                   Fail:(HTTPRequestManagerFail)fail
{
    NSDictionary *parame = @{
                             @"mobile" : mobile
                             
                             };
    //请求Action
    NSString *url = @"/v1/user/get-register-sms";
    
    [self UnifiedHttpRequestWithURL:url Parameters:parame RequestType:RequestTypePost Success:^(id responseData) {
        
        if (success) {
            success();
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
    
}

//
- (void)getCertificationVerticodeWithSMSType:(NSString *)sms_type
                                     Success:(void(^)(void))success
                                        Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = [NSString stringWithFormat:@"/v1/real-name/get-real-sms?access-token=%@",sZGLUserInfoModel.token];
    NSDictionary *param = @{
                            @"sms_type":sms_type
                            };
    
    [self UnifiedHttpRequestWithURL:url Parameters:param RequestType:RequestTypePost Success:^(id responseData) {
        
        if (success) {
            success();
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        if (fail) {
            fail(bef_status, bef_message, error);
        }
    }];
    
}


//注册接口
- (void)registWithMobilePhone:(NSString *)mobile
                     Password:(NSString *)password
                SmsVerifyCode:(NSInteger)smsVertifyCode
              RegisterChannel:(NSInteger)registerChannel
                      Success:(void (^)(id responseData))success
                         Fail:(HTTPRequestManagerFail)fail
{
    NSDictionary *param = @{
                            @"mobile" : mobile,
                            @"password" : password,
                            @"sms_verify_code" : @(smsVertifyCode),
                            @"register_channel" : @(registerChannel)
                            
                            };
    
    NSString *url = @"/v1/user/register";
    
    [self UnifiedHttpRequestWithURL:url Parameters:param RequestType:RequestTypePost Success:^(id responseData) {
        
        if (success) {
            success(responseData);
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
    
}

//登录接口
- (void)loginWithMobilPhone:(NSString *)mobile
                   Password:(NSString *)password
                  LoginType:(NSString *)loginType
                 DeviceName:(NSString *)deviceName
                DeviceModel:(NSString *)deviceModel
                    Success:(void(^)(id responseData))success
                       Fail:(HTTPRequestManagerFail)fail
{
    
    
    NSDictionary *param = @{
                            @"username" : mobile,
                            @"password" : password,
                            @"login_type" : loginType,
                            @"device_name" : deviceName,
                            @"device_model" : deviceModel
                            
                            };
    
    NSString *url = @"/v1/user/login";
    
    [self UnifiedHttpRequestWithURL:url Parameters:param RequestType:RequestTypePost Success:^(id responseData) {
        
//        ZGLResponseInfo *Info = [ZGLResponseInfo new];
        
        if (success) {
            success(responseData);
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
}


//获取对战列表
- (void)GetTheBattleListSuccess:(void(^)(id responseData))success
                           Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = @"/v1/app/get-play-list";
    
    [self UnifiedHttpRequestWithURL:url Parameters:nil RequestType:RequestTypeGet Success:^(id responseData) {
        
        
        
        if (success) {
            success(responseData);
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
    
}

//创建订单
- (void)creatOrderWithToken:(NSString *)token
                  LotteryId:(NSString *)lotteryId
                    Content:(NSString *)content
                       Darw:(NSString *)darw
                  GroupType:(NSString *)groupType
                   Multiple:(NSString *)multiple
                     Amount:(NSString *)amount
                     BetNum:(NSString *)betNum
                   MaxPrize:(NSString *)maxPrize
                   MinPrize:(NSString *)minPrize
                    Success:(HTTPRequestManagerSuccess)success
                       Fail:(HTTPRequestManagerFail)fail
{
    NSString *url =[NSString stringWithFormat:@"/v1/order/create-order?access-token=%@",token];
    //@"/v1/order/create-order";
    
    NSDictionary *param = @{
                            @"lottery_id" : lotteryId,
                            @"content" : content,
                            @"draw" : darw,
                            @"group_type" : groupType,
                            @"multiple" : multiple,
                            @"amount" : amount,
                            @"bet_num" : betNum,
                            @"max_prize" : maxPrize,
                            @"min_prize" : minPrize
                            
                            };
    
    [self UnifiedHttpRequestWithURL:url Parameters:param RequestType:RequestTypePost Success:^(id responseData) {
        
        if (success) {
            success(responseData);
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
    
    
    
    
}

//获取订单列表
- (void)getOrderListWithStatus:(NSString *)status
                         Token:(NSString *)token
                       Success:(void(^)(id responsedata))success
                          Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = [NSString stringWithFormat:@"/v1/order/order-list?access-token=%@",token];

    NSDictionary *param = [NSDictionary dictionary];
    if (status) {
        
        param = @{
                  @"status":status
                  };
    }
    
    [self UnifiedHttpRequestWithURL:url Parameters:param RequestType:RequestTypeGet Success:^(id responseData) {
        
        DLog(@"%@",responseData);
        if (success) {
            success(responseData);
        }
        
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        DLog(@"%@",error);
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
}

//余额支付
- (void)useBalancePayWithOrderNum:(NSString *)number
                          Success:(void(^)(id responsedata))success
                             Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = [NSString stringWithFormat:@"/v1/account/balance-pay?access-token=%@",sZGLUserInfoModel.token];
    NSDictionary *param = @{
                            
                            @"order_no": number
                            };
    
    [self UnifiedHttpRequestWithURL:url Parameters:param RequestType:RequestTypePost Success:^(id responseData) {
        
        DLog(@"%@",responseData);
        if (success) {
            success(responseData);
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        DLog(@"%@",error);
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
    
    
}

//更新个人信息
- (void)UpdatePersonalInformationWithSuccess:(void(^)(id responsedata))success
                                        Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = [NSString stringWithFormat:@"/v1/user/get-user-info?access-token=%@",sZGLUserInfoModel.token];
    
    [self UnifiedHttpRequestWithURL:url Parameters:nil RequestType:RequestTypeGet Success:^(id responseData) {
        
        DLog(@"%@",responseData);
        if (success) {
            success(responseData);
        }
        
        
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        DLog(@"%@",error);
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
    
    
}

//实名认证
- (void)RealNameAuthenticationWithMobile:(NSString *)mobile
                               VertiCode:(NSString *)code
                                  IdCard:(NSString *)idCard
                                RealName:(NSString *)realName
                                 Success:(void(^)(id responsedata))success
                                    Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = [NSString stringWithFormat:@"/v1/real-name/add?access-token=%@",sZGLUserInfoModel.token];
    NSDictionary *param = @{
                            
                            @"mobile"   : mobile,
                            @"code"     : code,
                            @"id_card"  : idCard,
                            @"real_name":realName
                            };
    
    [self UnifiedHttpRequestWithURL:url Parameters:param RequestType:RequestTypePost Success:^(id responseData) {
        
        DLog(@"%@",responseData);
        if (success) {
            success(responseData);
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        DLog(@"%@",error);
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
    
    
}

//绑定银行卡
- (void)BankCardBindingWithNum:(NSString *)num
                      Location:(NSString *)location
                      bankType:(NSString *)type
                       Success:(void(^)(id responsedata))success
                          Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = [NSString stringWithFormat:@"/v1/real-name/add-bank-card?access-token=%@",sZGLUserInfoModel.token];
    NSDictionary *param = @{
                            /*
                             num    是    string    卡号
                             local    是    string    开户所在地
                             bank_type    是    string    银行类别
                             */
                            @"num":num,
                            @"local":location,
                            @"bank_type":type
                            
                            };
    
    [self UnifiedHttpRequestWithURL:url Parameters:param RequestType:RequestTypePost Success:^(id responseData) {
        
        DLog(@"%@",responseData);
        if (success) {
            success(responseData);
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        DLog(@"%@",error);
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
    
    
}

//
- (void)getBankCardInfoWithSuccess:(void(^)(id responsedata))success
                              Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = [NSString stringWithFormat:@"/v1/real-name/get-withdraw-info?access-token=%@",sZGLUserInfoModel.token];
    
    [self UnifiedHttpRequestWithURL:url Parameters:nil RequestType:RequestTypeGet Success:^(id responseData) {
        
        DLog(@"%@",responseData);
        if (success) {
            success(responseData);
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        DLog(@"%@",error);
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
}

//
- (void)extractCashComfirmWithCash:(NSString *)cash
                         VertiCode:(NSString *)code
                           Success:(void(^)(id responsedata))success
                              Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = [NSString stringWithFormat:@"/v1/real-name/set-withdraw?access-token=%@",sZGLUserInfoModel.token];
    
    NSDictionary *param = @{
                            @"cash":cash,
                            @"code":code
                            };
    
    [self UnifiedHttpRequestWithURL:url Parameters:param RequestType:RequestTypePost Success:^(id responseData) {
        
        DLog(@"%@",responseData);
        if (success) {
            success(responseData);
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        DLog(@"%@",error);
        if (fail) {
            fail(bef_status, bef_message, error);
        }
        
    }];
    
    
}

//
- (void)getPaylistWithSuccess:(void(^)(id responsedata))success
                         Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = [NSString stringWithFormat:@"/v1/app/get-payment-mode?access-token=%@",sZGLUserInfoModel.token];
    
    [self UnifiedHttpRequestWithURL:url Parameters:nil RequestType:RequestTypeGet Success:^(id responseData) {
        
        DLog(@"%@",responseData);
        if (success) {
            success(responseData);
        }
        
    } Fail:^(ZGLRespondStatusCode bef_status, NSString *bef_message, NSError *error) {
        
        DLog(@"%@",error);
        if (fail) {
            fail(bef_status, bef_message, error);
        }
    }];
}


#pragma mark - 预测数据
/*
 
 */
- (void)getThePredictedResultsList:(void(^)(id responsedata))success
                              Fail:(HTTPRequestManagerFail)fail
{
    NSDateFormatter *dateFormatter=[[NSDateFormatter alloc]init];
    [dateFormatter  setDateFormat:@"yyyyMMdd"];
    NSString *dateString=[dateFormatter stringFromDate:[NSDate date]];
    
//    NSString *api=[[NSString alloc] initWithFormat:@"http://betcat.zeeging.com/index.php/Api/getMatchList?date=%@",dateString];
    NSString *api = @"http://betcat.zeeging.com/index.php/Api/getMatchList";
    
    [LYDsession sessionGET:api Success:^(NSData *data) {
        
        DLog(@"%@",data);
        ZGLResponseInfo *Info = [ZGLResponseInfo new];
        [Info mj_setKeyValues:data];
        NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
        
        if (success) {
            success(jsonData);
        }
        
    } failer:^(NSError *error) {
        DLog(@"%@",error);
        if (fail) {
            fail(-1, nil, error);
        }
        
    }];
}


//
- (void)getMessageDataWithMatchID:(NSString *)matchId
                          Success:(void(^)(id responsedata))success
                             Fail:(HTTPRequestManagerFail)fail
{
    NSString *api = [NSString stringWithFormat:@"http://betcat.zeeging.com/index.php/Api/getIntelligence?matchid=%@",matchId];
    
    [LYDsession sessionGET:api Success:^(NSData *data) {
        
        DLog(@"%@",data);
        ZGLResponseInfo *Info = [ZGLResponseInfo new];
        [Info mj_setKeyValues:data];
        NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
        
        if (success) {
            success(jsonData);
        }
        
    } failer:^(NSError *error) {
        DLog(@"%@",error);
        if (fail) {
            fail(-1, nil, error);
        }
        
    }];
    
    
//    AFHTTPSessionManager *sessionManager = [ZGLHTTPSessionManager sharedHTTPSession];
//    [sessionManager GET:api parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
//        
//        
//    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
//        
//        
//    }];
//    
    
}


#pragma mark - 新闻
//
- (void)getNewsListDataSuccess:(void(^)(id responsedata))success
                          Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = @"http://betdata.zeeging.com/index.php/index/getSinaSportsNewsList";
    
    [LYDsession sessionGET:url Success:^(NSData *data) {
        
        DLog(@"%@",data);
        ZGLResponseInfo *Info = [ZGLResponseInfo new];
        [Info mj_setKeyValues:data];
        NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
        
        if (success) {
            success(jsonData);
        }
        
    } failer:^(NSError *error) {
        
        DLog(@"%@",error);
        if (fail) {
            fail(-1, nil, error);
        }
        
    }];
    
}

#pragma mark - 积分榜

//
- (void)getScoreBoardListWithLeagueid:(NSInteger )leagueid
                              Success:(void(^)(id responsedata))success
                                 Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = [NSString stringWithFormat:@"http://betdata.zeeging.com/index.php/index/getLeagueTable?leagueid=%ld",leagueid];
    
    [LYDsession sessionGET:url Success:^(NSData *data) {
        
        DLog(@"%@",data);
        ZGLResponseInfo *Info = [ZGLResponseInfo new];
        [Info mj_setKeyValues:data];
        id jsonData = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
        
        if (success) {
            success(jsonData);
        }
        
    } failer:^(NSError *error) {
        
        DLog(@"%@",error);
        if (fail) {
            fail(-1, nil, error);
        }
        
    }];
    
}

//
- (void)getMainPageDataSuccess:(void(^)(id responsedata))success
                          Fail:(HTTPRequestManagerFail)fail
{
    NSString *url = @"http://betcat.zeeging.com/index.php/Api/getHomePageData";
    
    [LYDsession sessionGET:url Success:^(NSData *data) {
        
        DLog(@"%@",data);
        ZGLResponseInfo *Info = [ZGLResponseInfo new];
        [Info mj_setKeyValues:data];
        id jsonData = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
        
        if (success) {
            success(jsonData);
        }
        
    } failer:^(NSError *error) {
        
        DLog(@"%@",error);
        if (fail) {
            fail(-1, nil, error);
        }
    }];
    
}






#pragma mark - 网络请求统一接口
/**
 *
 *
 *  @param api         后台的接口名
 *  @param params      参数dict  GET 可以为nil
 *  @param requestType 请求类型
 *  @param success     成功回调
 *  @param fail    失败回调
 */
- (void)UnifiedHttpRequestWithURL:(NSString *)api Parameters:(id)params RequestType:(RequestType)requestType Success:(HTTPRequestManagerSuccess)success Fail:(HTTPRequestManagerFail)fail
{
    AFHTTPSessionManager *sessionManager = [ZGLHTTPSessionManager sharedHTTPSession];
    
    //地址
    NSString *url = [NSString stringWithFormat:@"%@%@",ZGL_SERVER_URL,api];
    url=[url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
    
    //参数判断
    if (params==nil) {
        params=[NSMutableDictionary dictionary];
    }
    
    //
    NSString *allUrl=[self urlDictToStringWithUrlStr:url WithDict:params];
    DLog(@"\n\n 网址 \n\n      %@    \n\n 网址 \n\n 传的参数 \n\n      %@         \n\n",allUrl,params);
    
    //判断请求方式
    if (requestType == RequestTypeGet) {
        
        [sessionManager GET:url parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
            
            DLog(@"GET请求成功");
            ZGLResponseInfo *Info = [ZGLResponseInfo new];
            Info.wholeQueryUrl = task.currentRequest.URL;
            [Info mj_setKeyValues:responseObject];
            NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:responseObject options:kNilOptions error:nil];
            
            
            DLog(@"responseData--%@",jsonData);
            if (success) {
                if (Info.data == nil) {
                    Info.data = jsonData;
                }
                success(Info.data);
            }
            
            
        } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
            
            DLog(@"GET请求失败--%@",error);
            if (fail) {
                fail(-1, nil, error);
            }

        }];
        
    }else if (requestType == RequestTypePost){
        
        [sessionManager POST:url parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
            
            DLog(@"POST请求成功");
            ZGLResponseInfo *Info = [ZGLResponseInfo new];
            Info.wholeQueryUrl = task.currentRequest.URL;
            [Info mj_setKeyValues:responseObject];
            NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:responseObject options:kNilOptions error:nil];
            
            
            DLog(@"responseData--%@",jsonData);
            if (success) {
                if (Info.data == nil) {
                    Info.data = jsonData;
                }
                success(jsonData);
            }
            
            
        } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
            
            DLog(@"POST请求失败--%@",error);
            if (fail) {
                fail(-1, nil, error);
            }
            
        }];
    }
}

/**
 *  执行failureBlock
 *
 *  @param failure failureBlock
 *  @param error   error
 *
 *  @since 1.0
 */
- (void)excuteFailureBlock:(HTTPRequestManagerFail)failure responseInfo:(ZGLResponseInfo *)responseInfo error:(NSError*)error {
    //统一错误处理机制
    NSInteger bef_status = responseInfo.status;
    NSString *bef_message_tmp = responseInfo.message;
    
    if(failure){
        //TODO: 注释掉这句
        //        [LSYResponseInfo requestFailedWithErrorCode:bef_status andMassage:bef_message_tmp andErrorCode:error];
//        if(![self isAPIServerReachable]){
//            failure(TT_E_NOT_NETWORK, @"没有网络", error);
//        }else {
            failure(bef_status,bef_message_tmp,error);
//        }
    }
}

#pragma mark - 拼接请求的网络地址 此处是为了NSLog出传入的值，方便查看
/**
 *  拼接请求的网络地址
 *
 *  @param urlString     基础网址
 *  @param parameters 拼接参数
 *
 *  @return 拼接完成的网址
 */
-(NSString *)urlDictToStringWithUrlStr:(NSString *)urlString WithDict:(NSDictionary *)parameters
{
    if (!parameters) {
        return urlString;
    }
    
    NSMutableArray *parts = [NSMutableArray array];
    //enumerateKeysAndObjectsUsingBlock会遍历dictionary并把里面所有的key和value一组一组的展示给你，每组都会执行这个block 这其实就是传递一个block到另一个方法，在这个例子里它会带着特定参数被反复调用，直到找到一个ENOUGH的key，然后就会通过重新赋值那个BOOL *stop来停止运行，停止遍历同时停止调用block
    [parameters enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
        //字符串处理
        key=[NSString stringWithFormat:@"%@",key];
        obj=[NSString stringWithFormat:@"%@",obj];
        
        //接收key
        NSString *finalKey = [key stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        //接收值
        NSString *finalValue = [obj stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        
        
        NSString *part =[NSString stringWithFormat:@"%@=%@",finalKey,finalValue];
        
        [parts addObject:part];
        
    }];
    
    NSString *queryString = [parts componentsJoinedByString:@"&"];
    
    queryString = queryString.length!=0 ? [NSString stringWithFormat:@"?%@",queryString] : @"";
    
    NSString *pathStr = [NSString stringWithFormat:@"%@%@",urlString,queryString];
    
    return pathStr;
    
}

@end




#pragma mark - ZGLResponseInfo
@implementation ZGLResponseInfo

+ (void)requestFailedWithErrorCode:(ZGLRespondStatusCode)code andMassage:(NSString *)msg andErrorCode:(NSError *)error;
{
    //不再显示进行中的提示框
//    [ReminderHUD disappear];
    [self reminderLocalFailedMassageWithErrorCode:code andMassage:msg];
}

+ (void)reminderLocalFailedMassageWithErrorCode:(ZGLRespondStatusCode)code andMassage:(NSString *)msg
{
    switch (code)
    {
        case TT_E_ConnectionError:{
//            [LSYTopMsgView showMassage:@"网络异常，稍后再试" time:DelayTime state:LSYTopMsgViewStatusBarTypeWarning];
            break;
        }
        case TT_E_FAIL_GET_DATA:{
//            [LSYTopMsgView showMassage:@"数据异常" time:DelayTime state:LSYTopMsgViewStatusBarTypeNomal];
            break;
        }
        case TT_E_OK:{
//            [LSYTopMsgView showMassage:msg time:DelayTime state:LSYTopMsgViewStatusBarTypeNomal];
            break;
        }
        case MAC_CHANGE:{
            
//            [LSYTopMsgView showMassage:msg time:DelayTime state:LSYTopMsgViewStatusBarTypeWarning];
            
            break;
        }
        default:
//            [LSYTopMsgView showMassage:msg time:DelayTime state:LSYTopMsgViewStatusBarTypeNomal];
            
            break;
    }
    
}


@end
